<script type="text/javascript">
function copycode(copyText){
    if (window.clipboardData){
        window.clipboardData.setData("Text", copyText);
    }else{
        prompt('<{t}>请按 ctrl+c 复制：<{/t}>',copyText);
    }
}
</script>
<div class="notice">
  <{t}>请根据页面要求填写信息并保存后，再登录公号平台mp.weixin.qq.com开启开发模式并配置token及url<{/t}>
</div>
<form action="index.php?app=weixin&ctl=admin_bind&act=save_bind" id='newbind-edit-form' method="POST">
  <{if $data.id}>
  <input type="hidden" value=<{$data.id}> name="id">
  <{/if}>
  <{input type="hidden" name="eid" value=$data.eid vtype="required"  class="x-input " autocomplete="off"}>
  <div class="tableform">
		<div class="division">
      <table width="100%" cellspacing="0" cellpadding="0">
        <tbody>
          <tr>
            <th><em class="red"></em><label for="url"><{t}>url:<{/t}></label></th>
            <td><span><{$data.url}></span>
            <{button onclick="copycode(this.getPrevious().innerHTML)" label="复制"}>
            <{input type="hidden" name="url" value=$data.url id="url"  vtype="required"  class="x-input " autocomplete="off"}></td>
          </tr>
          <tr>
            <th><em class="red"></em><label for="token"><{t}>token:<{/t}></label></th>
            <td>
              <span><{$data.token}></span>
              <{button onclick="copycode(this.getPrevious().innerHTML)" label="复制"}>
              <{input type="hidden" name="token" value=$data.token id="token"  vtype="required"  class="x-input " autocomplete="off"}>
              <br>
              <span class="red"><{t}>请将上述的url和token值复制粘贴到微信公众平台中配置 功能》高级功能》开发模式》服务器配置<{/t}></span>
            </td>
          </tr>
          <tr>
            <th><em class="red">*</em><label for="name"><{t}>公众账号名称:<{/t}></label></th>
            <td><{input type="text" name="name" value=$data.name id="name" required="1" vtype="required" class="x-input " autocomplete="off"}></td>
          </tr>
          <tr>
            <th><em class="red">*</em><label for="dom_el_2a317d0"><{t}>微信账号类型:<{/t}></label></th>
            <td>
              <{input type="select" required=true name='weixin_type' options=$weixin_type_select value=$data.weixin_type vtype="required"}>
            </td>
          </tr>
          <tr>
            <th><em class="red">*</em><label for="weixin_account"><{t}>微信号:<{/t}></label></th>
            <td>
              <{input type="text" name="weixin_account" value=$data.weixin_account id="weixin_account"  required="1" vtype="required" class="x-input " autocomplete="off"}>
              <br>
              <span class="notice-inline"><{t}>该项内容请至微信公众平台 设置》账号信息 中复制粘贴过来<{/t}></span>
            </td>
          </tr>
          <tr>
            <th><em class="red">*</em><label for="weixin_id"><{t}>原始ID:<{/t}></label></th>
            <td>
              <{input type="text" name="weixin_id" value=$data.weixin_id id="weixin_id" vtype="required" size=40 class="x-input " autocomplete="off"}>
              <br>
              <span class="notice-inline"><{t}>该项内容请至微信公众平台 设置》账号信息 中复制粘贴过来<{/t}></span>
            </td>
          </tr>
          <tr>
            <th><em class="red">*</em><label for="email"><{t}>登录邮箱:<{/t}></label></th>
            <td>
              <{input type="text" name="email" value=$data.email id="email"  vtype="required" size=40 class="x-input " autocomplete="off"}>
              <br>
              <span class="notice-inline"><{t}>该项内容请至微信公众平台 设置》账号信息 中复制粘贴过来<{/t}></span>
            </td>
          </tr>
          <tr>
            <th><em class="red"></em><label for="appid"><{t}>AppId:<{/t}></label></th>
            <td><{input type="text" name="appid" value=$data.appid id="appid" required="1" size=40  class="x-input " autocomplete="off"}></td>
          </tr>
          <tr>
            <th><em class="red"></em><label for="token"><{t}>AppSecret:<{/t}></label></th>
            <td>
              <{input type="text" name="appsecret" value=$data.appsecret id="appsecret" size=40  class="x-input " autocomplete="off"}>
              <span class="notice-inline"><{t}>上述Appid和AppSecret值请至微信公众平台（此配置为服务号或认证过的订阅号） <{/t}></span>
              <span class="notice-inline"><{t}> 功能》高级功能》开发模式》开发者凭据 中复制粘贴过来<{/t}></span>
            </td>
          </tr>
          <tr>
            <th><em class="red"></em><label for="qr"><{t}>二维码:<{/t}></label></th>
            <td><{input type="image" name="qr" id="qr" value=$data.qr class="x-input " autocomplete="off"}></td>
          </tr>
          <tr>
            <th><em class="red"></em><label for="avatar"><{t}>头像:<{/t}></label></th>
            <td><{input type="image" name="avatar" id="avatar" value=$data.avatar class="x-input " autocomplete="off"}></td>
          </tr>
          <tr>
            <th><em class="red">*</em><label for="status"><{t}>是否启用:<{/t}></label></th>
            <td>
              <input type="radio" name="status" value='active' <{if $data.status!= 'disabled'}>checked<{/if}>> <{t}>启用<{/t}>
              <input type="radio" name="status" value='disabled'<{if $data.status == 'disabled'}>checked<{/if}>> <{t}>禁用<{/t}> 
            </td>
          </tr>
        </tbody>
      </table>
		</div>
	</div>
</form>

<div class="table-action">
  <table width="100%" cellspacing="0" cellpadding="0">
    <tbody>
      <tr>
        <td>
          <{button class="btn-primary" id="newbind-edit-form-submit" type="submit" label=$___wap="确定"|t:'wap'}>
        </td>
      </tr>
    </tbody>
  </table>
</div>

<script>
  (function(){
    var _form = $('newbind-edit-form');
    var btn =$('newbind-edit-form-submit');
    var finder = finderGroup['<{$env.get._finder.finder_id}>'];

    _form.store('target',{
      onSuccess:function(response){
        var hash_res_obj = JSON.decode(response);

        if (hash_res_obj.success != undefined && hash_res_obj.success != "")
    {
      try{
        var _dialogIns = btn.getParent('.dialog').retrieve('instance');
      }catch(e){}

      if(_dialogIns)
    {
      _dialogIns.close();
      window.finderGroup['<{$env.get._finder.finder_id}>'].refresh();
    }
    }

      }
    });
    btn.addEvent('click',function(){
      _form.fireEvent('submit',{stop:$empty});
    });

  })();
</script>
